<?php
require_once('./includes/headers.inc.php');
require_once('./top.php');

$error = FALSE;

$users = $userMgr->getAllUsers();

$user_list = array();
$user_count = count($users);
$checkin_count = 0;
foreach($users as $row) {
    $checkin_count += $row['count'];
    $user_list[] = '<li>' . date('d-m-Y', strtotime($row['registered'])) . ' <a href="/viewuser.php?id=' . $row['id'] . '">' . $row['name'] . '</a> ' . ($row['password'] != '' ? '' : '(' . $langMgr->get('text_inactive') . ')') . ' - ' . $row['count'] . ' ' . $langMgr->get('text_checkins') . '</li>';
}

$replaces = array(
    //'user_count'        => $user_count,
    //'checkin_count'     => $checkin_count,
    'user_list'         => implode("\n", $user_list),
    'error'             => $msgMgr->formatMsg($error),
);
$lang = array(
    'header_allusers'   => $langMgr->get('header_allusers'),
    'text_allusers_stats' => $langMgr->get('text_allusers_stats', false, array('user_count' => $user_count, 'checkin_count' => $checkin_count)),
);
$templateMgr->loadContent(basename(__FILE__, '.php'), array_merge($replaces, $lang));
?>
